freecivfandomcom-20200223-history
User blog:Phlox/Eclipse Debug setup
Eclipse version downloaded was “Classic”, and was selected from this list (here). I downloaded latest, version 4.2. * Opened Zip file and moved to c:\programs\Eclipse * Clicked on Eclipse.exe in that folder to initialise. It asks for a workplace folder. I set it to a different volume- in my case K:\EcProj * Eclipse menu item Help > Install new software, url chose was the first default- I think it said Juno something. The entries are not there anymore so TBD- verify name on next install. ** Clicked Programming tools. All the C / C++ checkboxes. * This might be wrong, but what I did after it reloaded was a File.Import.Import. C/C++. Import code as a makefile project. Then I pointed to the root directory of my FC source directory. * Menu Run.Debug Configurations. C / C++ . New button * You now have an entry under C/C++ Named new configuration unless you have already renamed it. ** Main tab: ***Application name: In my case I point to the sdl client C:\MinGW\msys\1.0\home\fc23\client\freeciv-sdl.exe ***Project name In my case it is the directory name I pointed to in Import Code as Makefile project (FC23) ** Arguments tab: ***--log client.log --debug 2 *** Working directory I left default clicked, and the SDL client came up ok. Otherwise, following the VStudio general setup, I would have set it to my test directory: K:\Freeciv01 (Note you will have to have the SDL-theme directory in the proper place in the tree)- see SDL Vstudio blog post for details. ** Debugger tab. I left these settings at defaults, all of the following: *** gdb debugger: gdb GDB command file: .gdbinit *** No optional checkboxes *** Stop at: main I imagine I could set this to SDL_main or some other function after all the inits/ throat clearing. ** Source tab I didn't have to add anything. It found the source files in the debug session, probably due to the import code as makefile project step. *Run.Debug, I got Errors exist in the active configuration of project "fc23" Proceed with Launch (hit "Proceed") *File.Open File point to dummy.c (where I relocated SDL_Main, but otherwise set breakpoint on to main() in gui_main.c in gui-sdl. *Right click to left of line you want to set a breakpoint. On the popup list, click toggle breakpoint *Menu Run.Resume *You should be at your breakpoint... do all the normal commands. Note that this IDE appears to be exceptionally slow. Be patient. If it appears hung, wait a while before banging on things. My version took a good half minute to get through all of the initializations before it displayed the first screen. On my first SDL client debug, I saw the same SDL functionality as in Visual studio. Yay. Now we have an IDE that at least appears reasonable: *execute macros on breakpoints with watch value if expressions, *C code unit testing add ons *debuggers and plugins for lots of other stuff like lua, python, droid cross development etc. *I saw some stuff on memory monitoring, but haven't investigated yet. It would be surprising if there isn't some decent tools for memory leak detection. Double yay. Category:Blog posts